import htmllib, formatter, urllib
import os, sys
import parsers

class ParserOrkut():    
    def __init__(self, type, in_data):        
        self.parser_type = type
        self.input_data = in_data
        if(type=="friends"):
            self.parser = parsers.ParserOrkutFriends()
        elif(type=="communities"):
            self.parser = parsers.ParserOrkutCommunities() 
        elif(type=="profile"):
            self.parser = parsers.ParserOrkutProfile()
        elif(type=="scrapbook"):
            self.parser = parsers.ParserOrkutScrapbook()
    def get_parser(self):
        return self.parser
    def get_data(self):
        return self.input_data
    def get_next_link(self):
        if(self.parser_type=="friends" or self.parser_type=="scrapbook"):
            return self.parser.get_next_link()
    def has_next_link(self):
        if(self.parser_type=="friends" or self.parser_type=="scrapbook"):
            return self.parser.has_next_link()
    def get_friends(self):
        if(self.parser_type == "friends"):
            return self.parser.get_friends()
    def get_testimonials(self):
        if(self.parser_type == "profile"):
            return self.parser.get_testimonials()
    def get_communities(self):
        if(self.parser_type == "communities"):
            return self.parser.get_communities()
    def get_scraps(self):
        if(self.parser_type == "scrapbook"):
            return self.parser.get_scrapbooks()
    def parse(self):
        self.parser.feed(self.input_data)
        self.parser.close()

#EOF
